﻿Imports System.Data.SqlClient
Imports UTNComputers.clsCatalogo

Public Class clsVidriera
    Private mVid_Id As Int32
    Private mProd_Id As Int32
    Private mNro_Serie As String
    Private mFecha_Alta As Date
    Private mEstado As String
    Private mFecha_Baja As Date
    Private mProducto As clsCatalogo
    Private mCod_Suc As Int32

    '/////////////////////////////////////////////////////////
    '/ Propiedades
    '/////////////////////////////////////////////////////////
    Public Property Vid_Id() As Int32
        Get
            Return mVid_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mVid_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de vidriera. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Prod_Id() As Int32
        Get
            Return mProd_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mProd_Id = value
            Else
                Throw New Exception("No se puede utilizar el código del producto. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Nro_Serie() As String
        Get
            Return mNro_Serie
        End Get
        Set(ByVal value As String)
            mNro_Serie = Left(value, 20)
        End Set
    End Property
    Public Property Fecha_Alta() As Date
        Get
            Return mFecha_Alta
        End Get
        Set(ByVal value As Date)
            mFecha_Alta = value
        End Set
    End Property
    Public Property Estado() As String
        Get
            Return mEstado.Trim.ToUpper
        End Get
        Set(ByVal value As String)
            If (value.Trim.ToUpper.Length = 1 And (value.Trim.ToUpper = "A" Or value.Trim.ToUpper = "I")) Then
                mEstado = value.Trim.ToUpper
            Else
                Throw New Exception("No se puede utilizar el estado del sorteo.")
            End If
        End Set
    End Property
    Public Property Fecha_Baja() As Date
        Get
            Return mFecha_Baja
        End Get
        Set(ByVal value As Date)
            mFecha_Baja = value
        End Set
    End Property
    Public Property Producto() As clsCatalogo
        Get
            Return mProducto
        End Get
        Set(ByVal value As clsCatalogo)
            mProducto = value
        End Set
    End Property
    Public Property Cod_Suc() As Int32
        Get
            Return mCod_Suc
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCod_Suc = value
            Else
                Throw New Exception("Codigo de sucursal incorrecto")
            End If
        End Set
    End Property
    '/////////////////////////////////////////////////////////
    '/ Métodos de la Clase
    '/////////////////////////////////////////////////////////

    '---------------------------------------------------------------------
    ' Constructor de la Clase
    '---------------------------------------------------------------------
    Public Sub New()

        MyBase.New()

    End Sub
    '---------------------------------------------------------------------
    ' Destructor de la Clase
    '---------------------------------------------------------------------
    Public Sub Dispose()

        MyBase.Finalize()

    End Sub


End Class
